﻿<div class="ld-tabs">
    <ul>
        <li class="k-state-active">会议列表</li>
    </ul>
    <div>
        <div id="grid_meeting" style="text-align: center"></div>
    </div>
</div>

<script class="grid_meeting_columns">
    var fields = [{
        title: "#",
        field: "ID",
        width: 50
    }, {
        title: "标题",
        field: "Title",
        width: 300
    }, {
        title: "主持人密码",
        field: "AdminPassword",
        width: 100
    }, {
        title: "参会者密码",
        field: "JoinPassword",
        width: 100
    }, {
        title: "日期",
        template: "#=kendo.toString(kendo.parseDate(CreatedOn),'yyyy-MM-dd')#",
        width: 100
    }, {
        title: "操作",
        template: "#=GetOperations(ID)#",
        attributes: { style: "text-align:left" }
    }];

    function GetOperations(id) {
        var html = "<button class='k-button' onclick=\"Edit(" + id + ")\"><span class='k-icon k-i-pencil'></span><span>修改</span></button>";
        //html += "<button class='k-button' onclick=\"Delete(" + id + ")\"><span class='k-icon k-i-close'></span><span>删除</span></button>";
        return html;
    }

    function Edit(id) {
        if (wndGeneralEdit != null && typeof wndGeneralEdit != "undefined") {
            wndGeneralEdit.setOptions({ title: "修改会议" });
            wndGeneralEdit.refresh({ url: "/Admin/Fun/MeetingEdit/" + id });
            wndGeneralEdit.open();
        }
    }

</script>

<script class="grid_config">
    $(function () {
        $("#grid_meeting").kendoGrid({
            columns: fields,
            dataSource: Whale.dataSource({
                url: "/Admin/Fun/GetMeetings",
                pageSize: 10
            }),
            pageable: {
                messages: {
                    empty: "暂无数据"
                }
            },
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });

    function Filters() {
        $("#grid_meeting").data("kendoGrid").dataSource.page(0);
    }
</script>
